package cn.lg.soar.generator;

import cn.lg.soar.generator.model.GenConfig;
import cn.lg.soar.generator.model.TableInfo;
import cn.lg.soar.generator.util.Utils;

/**
 * 代码生成
 * @author luguoxiang
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
public class CodeGenerator {



    public static void main(String[] args1) throws Exception {
        TableInfo tableInfo = Utils.parseTableInfo("CREATE TABLE `bs_pallet_settle` (\n" +
                "  `id` bigint NOT NULL,\n" +
                "  `sn` varchar(50) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL COMMENT '编号',\n" +
                "  `type` tinyint NOT NULL DEFAULT '0' COMMENT '结算单类型（暂定结算、最终结算）',\n" +
                "  `status` tinyint(1) DEFAULT '0' COMMENT '结算状态-最终',\n" +
                "  `submit_status` varchar(16) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL COMMENT '提交状态',\n" +
                "  `contract_sn` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '合同单号',\n" +
                "  `purchase_order_id` bigint NOT NULL COMMENT '采购订单id',\n" +
                "  `purchase_order_sn` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '采购订单号',\n" +
                "  `start_date` date NOT NULL COMMENT '结算周期(起始)',\n" +
                "  `end_date` date NOT NULL COMMENT '结算周期(截止)',\n" +
                "  `funder_id` bigint NOT NULL COMMENT '资金方id',\n" +
                "  `funder` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '资金方',\n" +
                "  `settle_mode` varchar(32) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COMMENT '结算模式',\n" +
                "  `weight` decimal(13,4) DEFAULT NULL COMMENT '采购重量-最终',\n" +
                "  `create_record_user_id` bigint NOT NULL COMMENT '制单人id',\n" +
                "  `create_record_user` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '制单人姓名',\n" +
                "  `create_record_dept_id` bigint NOT NULL COMMENT '制单人部门id',\n" +
                "  `create_record_dept` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '制单人部门',\n" +
                "  `create_record_company_id` bigint NOT NULL COMMENT '制单人公司id',\n" +
                "  `create_record_company` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '制单人公司',\n" +
                "  `create_record_date` date NOT NULL COMMENT '制单日期',\n" +
                "  `exclude_tax_settle_amount` decimal(18,2) DEFAULT '0.00' COMMENT '本期结算不含税金额-最终',\n" +
                "  `include_tax_settle_amount` decimal(18,2) DEFAULT '0.00' COMMENT '本期结算含税金额-最终',\n" +
                "  `already_pay` decimal(18,2) DEFAULT '0.00' COMMENT '已付金额',\n" +
                "  `creator` bigint NOT NULL COMMENT '创建人',\n" +
                "  `create_by` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人账户',\n" +
                "  `create_time` datetime NOT NULL COMMENT '创建时间',\n" +
                "  `updater` bigint DEFAULT NULL COMMENT '更新人',\n" +
                "  `update_by` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新人账户',\n" +
                "  `update_time` datetime DEFAULT NULL COMMENT '更新时间',\n" +
                "  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标识（0-正常,1-删除）',\n" +
                "  `business_man_id` bigint DEFAULT NULL COMMENT '业务员id',\n" +
                "  `business_man` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '业务员名字',\n" +
                "  `business_month` date DEFAULT NULL COMMENT '业务所属月',\n" +
                "  `business_user_id` bigint DEFAULT NULL COMMENT '业务员id',\n" +
                "  `business_username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '业务员名字',\n" +
                "  `order_remain_advance_amount` decimal(18,2) DEFAULT NULL COMMENT '订单剩余预付款',\n" +
                "  `order_advance_amount` decimal(18,2) DEFAULT NULL COMMENT '订单预付金额',\n" +
                "  `contract_remain_advance_amount` decimal(18,2) DEFAULT NULL COMMENT '合同剩余预付款',\n" +
                "  `contract_advance_amount` decimal(18,2) DEFAULT NULL COMMENT '合同预付款',\n" +
                "  `order_bond_amount` decimal(18,2) DEFAULT NULL COMMENT '订单保证金',\n" +
                "  `contract_bond_amount` decimal(18,2) DEFAULT NULL COMMENT '合同保证金',\n" +
                "  `contract_remain_bond_amount` decimal(18,2) DEFAULT NULL COMMENT '合同剩余保证金',\n" +
                "  `order_remain_bond_amount` decimal(18,2) DEFAULT NULL COMMENT '订单剩余保证金',\n" +
                "  `post_id` bigint DEFAULT NULL COMMENT '岗位id',\n" +
                "  `post_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '岗位名称',\n" +
                "  `invoice_status` varchar(20) COLLATE utf8mb4_general_ci DEFAULT 'NO_INVOICE' COMMENT '开票状态：未开票：NO_INVOICE,已开票：YES_INVOICE',\n" +
                "  `payment_diff_amount` decimal(18,2) DEFAULT '0.00' COMMENT '托盘差值(结算单的收款单金额-结算单的应付金额)',\n" +
                "  `average` tinyint NOT NULL COMMENT '结算单价取加权平均值',\n" +
                "  `payable_pay` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '应付金额（尾款）',\n" +
                "  `provisional_status` tinyint DEFAULT NULL COMMENT '结算状态-暂定',\n" +
                "  `provisional_weight` decimal(15,4) unsigned DEFAULT '0.0000' COMMENT '采购重量-暂定',\n" +
                "  `provisional_settle_price` decimal(15,2) DEFAULT NULL COMMENT '结算单价-暂定',\n" +
                "  `provisional_settle_amount` decimal(18,2) DEFAULT NULL COMMENT '暂定结算金额',\n" +
                "  `provisional_settle_pay_amount` decimal(18,2) DEFAULT NULL COMMENT '暂定结算支付的金额',\n" +
                "  `final_settle_amount` decimal(18,2) DEFAULT NULL COMMENT '最终结算金额',\n" +
                "  `final_settle_pay_amount` decimal(18,2) DEFAULT NULL COMMENT '最终结算支付的金额',\n" +
                "  `has_provisional` tinyint(1) DEFAULT NULL COMMENT '是否有暂定结算(0否，1是)',\n" +
                "  `provisional_exclude_tax_settle_amount` decimal(18,2) DEFAULT '0.00' COMMENT '本期结算不含税金额-暂定',\n" +
                "  `provisional_include_tax_settle_amount` decimal(18,2) DEFAULT '0.00' COMMENT '本期结算含税金额-暂定',\n" +
                "  `final_status` tinyint DEFAULT NULL COMMENT '结算状态-最终',\n" +
                "  `final_weight` decimal(15,4) DEFAULT NULL COMMENT '采购重量-最终',\n" +
                "  `final_settle_price` decimal(15,2) DEFAULT NULL COMMENT '结算单价-最终',\n" +
                "  `final_exclude_tax_settle_amount` decimal(18,2) DEFAULT NULL COMMENT '本期结算不含税金额-最终',\n" +
                "  `final_include_tax_settle_amount` decimal(18,2) DEFAULT NULL COMMENT '本期结算含税金额-最终',\n" +
                "  `material_type_name` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '主分类',\n" +
                "  PRIMARY KEY (`id`) USING BTREE\n" +
                ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='托盘结算';");

        GenConfig genConfig = Utils.genConfig(tableInfo);
        Utils.generate(genConfig);
        System.out.println(genConfig);
    }

}
